:start
CALL 0_header.cmd
set step_total=4
if '%cookie%'=='ntfs' goto :ntfs
if '%cookie%'=='gimagex' goto :gimagex
if '%cookie%'=='bootbcd' goto :bootmgr
if '%cookie%'=='done' color 2f
if '%step%'=='done' goto :done
if defined step goto :status

goto :Main Menu

:done
ECHO Status: Done, reboot your computer and remove boot disk
ECHO.
goto :Main Menu

:status
CALL 0_status.cmd
ECHO.
REM Main Menu

:Main Menu
ECHO Run at least steps 1-4
ECHO.
ECHO 1. Format Drive using DiskPart
ECHO 2. Change NTFS type (optional)
ECHO 3. Connect to image server and run GImagex
ECHO 4. Install BootMGR on system partition (only Win 7)
ECHO.
ECHO 5. Command Line
ECHO 6. View README
ECHO 7. View Acknowledgements
ECHO Q. Quit
ECHO 0. Auto apply image WARNING! DANGER! WILL FORMAT!
ECHO.

REM ========== Choice Logic ============
set /p menu="%choice_text%"
if "%menu%" == "0" goto :auto
if "%menu%" == "q" goto :end
if "%menu%" == "7" goto :acknowledgement
if "%menu%" == "6" goto :readme
if "%menu%" == "5" goto :cmd
if "%menu%" == "4" goto :bootmgr
if "%menu%" == "3" goto :gimagex
if "%menu%" == "2" goto :ntfs
if "%menu%" == "1" goto :format

REM in case user doesn't enter a valid response go back to start
:break
goto start

:auto
call 0_auto.cmd

:format
1_diskpart.cmd
goto end

:ntfs
2_ntfs.cmd
goto end

:gimagex
3_gimagex.cmd
REM setting the step changes the status on return to main menu
goto end

:bootmgr
4_bootmgr.cmd
0_main_menu.cmd
goto end

:cmd
start 5_cmd.cmd
0_main_menu.cmd
goto end

:readme
start 5_readme.txt
0_main_menu.cmd
goto end

:acknowledgement
start 5_acknowledgements.txt
0_main_menu.cmd
goto end

:end
CALL 0_header.cmd
ECHO Don't forget to remove Boot Device.
Call 0_eject.cmd
ping 127.0.0.1 -n 4 > nul
exit